package com.gk.ldj.fastdev.helper;

import java.io.UnsupportedEncodingException;

public class ParamHelper
{
	public static void testParam(String param)
	{
		String[] encoder=new String[]{"iso-8859-1","gb2312","utf-8","gbk"};
		for(int i=0;i<encoder.length;i++)
		{
			for(int j=0;j<encoder.length;j++)
			{
				if(i!=j)
				{
					String e1=encoder[i];
					String e2=encoder[j];
					System.out.println("e1:"+e1+"  e2:"+e2);
					System.out.println("result:"+ convert(e1, e2, param));
				}
			}
		}
	}
	public static String convert(String c1, String c2, String a)
	{
		if(a==null||a.isEmpty())
		{
			return null;
		}
		byte[] b;
		String c = null;
		try
		{
			b = a.getBytes(c1);
			c = new String(b, c2);
			return c;
		}
		catch (UnsupportedEncodingException e)
		{
			e.printStackTrace();
		}
		return null;
	}
	
}
